package com.xl.baseMethod;

import lombok.extern.slf4j.Slf4j;

/**
 * JdkVersion: 1.8
 * Author: lei·xie
 * Created: 2024/8/5 0002 10:22
 * Description: 基本方法 优先级
 */
@Slf4j(topic = "b.Test4")
public class ThreadDemo04 {
    public static void main(String[] args) {
        Runnable task1 = ()->{
           int count = 0;
           for (;;) {
               System.out.println("--->1 "+count++);
           }
        };
        Runnable task2 = ()->{
            int count = 0;
            for (;;) {
                //Thread.yield();
                System.out.println("      --->2 "+count++);
            }
        };
        Thread t1 = new Thread(task1,"t1");
        Thread t2 = new Thread(task2,"t2");
        //t1.setPriority(Thread.MIN_PRIORITY);
        t1.start();
        //t2.setPriority(Thread.MAX_PRIORITY);
        t2.start();
    }
}
